$(document).ready(function()
    {
        baseurl=$('input#baseurl')
        prods=$('a#addtoshoping').get();
        pop=$('div#pop')
        pop2=$('div#pop2')
        itemsNo=$('#itemsNo')
        $.each(prods,function(){
            $(this).click(function(event){
                   event.preventDefault();
                prodid=$(this).attr('rel')
                toThis=this
                $.ajax({
                    type:"POST",
                    data:"prodid="+prodid,
                    url:"http://localhost/shopflowers/public/checkout/addproduct",
                    success: function (html)
                    {
                        if(html.indexOf("login") !=-1){
                                pop2.center()
                                pop2.html(html);
                        }else{
                                pop.center()
                                setTimeout("pop.hide()",1000)
                                //pop.html(html);
                                $(toThis).attr('class','')
                                $(toThis).css('background-color','red')
                                itemsNo.html(html)

                        }
                    }
                })
            })
        })
    })
function xyz(){
    $.ajax({
                    type:"POST",
                    url:"http://localhost/shopflowers/public/checkout/itemsno",
                    success: function (html)
                    {
                             itemsNo.html(html)
                    }
                })
}
xyz();

//to show div in the center of the page
jQuery.fn.center = function () {
    this.css("position","absolute");
    this.css("display","");
    this.css("top", ( $(window).height() - this.height() ) / 2+$(window).scrollTop() + "px");
    this.css("left", ( $(window).width() - this.width() ) / 2+$(window).scrollLeft() + "px");
    return this;
}